<?php
	class Configuration
	{
		private $vars = array();
		private $db;

		function __construct($db)
		{
			$this->db = $db;
			try
			{
				$stmt = $this->db->prepare("SELECT skey, sval FROM " . DB_PREFIX . "configuration ORDER BY id ASC");
				$stmt->execute();
				while ($node = $stmt->fetch(PDO::FETCH_ASSOC))
				{
					$this->$node['skey'] = $node['sval'];
				}
			}
			catch(Exception $e)
			{
				throw new Exception($e, 1);
				
			}
		}

		public function __set($index, $value)
		{
			$this->vars[$index] = $value;
		}

		public function __get($index)
		{
			return $this->vars[$index];
		}
	}
?>